package com.idol.pojo;

import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Supreme_Sir
 * @version 1.0
 * @className Configeration
 * @description
 * @date 2020/9/26 15:03
 **/
public class Configeration {
    private DataSource dataSource;
    Map<String, MappedStatement> mappedStatementMap = new HashMap<>();

    public DataSource getDataSource() {
        return dataSource;
    }

    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    public Map<String, MappedStatement> getMappedStatementMap() {
        return mappedStatementMap;
    }

    public void setMappedStatementMap(Map<String, MappedStatement> mappedStatementMap) {
        this.mappedStatementMap = mappedStatementMap;
    }

    public void putMappedStatement(String key, MappedStatement val) {
        this.mappedStatementMap.put(key, val);
    }

    public MappedStatement getMappedStatement(String key) {
        return this.mappedStatementMap.get(key);
    }

    public String getSqlType(String statementID) {
        return getMappedStatement(statementID).getSql().trim().split(" ")[0];
    }
}
